{% extends 'base_with_top_menu.html' %}

{% load go_back_link %}

{% block title %}User reservations{% endblock %}

{% block header %}User reservations{% endblock %}

{% block content %}
<p>{% go_back_link "Go back" %}</p>
<b>
    {{ first_name }} {{ last_name }}
    <br \>
    {{ email|urlize }}
    <br \>
    {{ message }}
</b>

<ul class='spaces'>
    {% for reservation in reservations %}
        <li>
            <b><a href='{{reservation.url}}'> {{ reservation.title }}</a></b>
            {% if can_rent %}
                <form action='.' method='post'>
                    <input type='hidden' name='rent' value='{{ reservation.id }}'>
                    <input type='submit' name='action' value='Rent' {% if reservation.rental_impossible %} disabled {% endif %}>
                </form>
            {% endif %}
            {% if can_cancel %}
                <form action='.' method='post'>
                    <input type='hidden' name='cancel' value='{{ reservation.id }}'>
                    <input type='submit' name='action' value='Cancel'>
                </form>
            {% endif %}
            <ul>
                <li>Shelf mark: {{ reservation.shelf_mark }}</li>
                <li>Authors: {{ reservation.authors|join:', ' }}</li>
                <li>From: {{ reservation.from_date }}</li>
                <li>To:   {{ reservation.to_date   }}</li>
                <li>Status: {% firstof reservation.rental_impossible "Ready" %}</li>
            </ul>
        </li>
    {% empty %}
        <b>No reservations.</b>
    {% endfor %}
</ul>


<a href='{{ cancel_all_url }}'>Cancel all reservations</a>
<p>
<a href='archive/'>Show archive</a>
<p>
<a href='new/'>Rent something else.</a>
<p>

<br/>
{% endblock %}
